package cmo.lby.rabbitmq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cmo.lby.common.Constant;

@Component
public class Sender {

	@Autowired
	private AmqpTemplate rabbitmqTemplate;
	
	public void send(String context) {
		//System.out.println("Send:" + context);
		rabbitmqTemplate.convertAndSend(Constant.QUEUE_NAME, context);
	}

	public void send(String exchange, String routingKey, String message) {
		rabbitmqTemplate.convertAndSend(exchange, routingKey, message);
	}
	
	public void fanoutExchangeSend(String message) {
		rabbitmqTemplate.convertAndSend(Constant.FANOUT_EXCHANGE_NAME, "", message);
	}
	
	public void sendDelay(String message) {
		rabbitmqTemplate.convertAndSend(Constant.FANOUT_EXCHANGE_NAME, "", message);
	}
}

